import { iFetcher } from "../iFetcher.js"
import { UserRankFetcher } from "./userRankFetcher.js"
import { UserRatingFetcher } from "./userRatingFetcher.js"
import { SubmitRecordfetcher } from "./userSubmitRecordFetcher.js"
import { CompetitionHistoryFetcher } from "./userCompetitionHistoryFetcher.js"
import { ContestInfoFetcherFactory } from './contestInfoFetcherFactory.js'
import { ContestProblemsFetcher } from "./contestProblemsFetcher.js"

class FetcherFactor {
    public static create(type: string): iFetcher | undefined {
        switch (type) {
            case "userRank":
                return new UserRankFetcher()
            case "userRating":
                return new UserRatingFetcher()
            case "userSubmit":
                return new SubmitRecordfetcher()
            case "userCompetitionHistory":
                return new CompetitionHistoryFetcher()
            case "contestInfo.permanent":
                return ContestInfoFetcherFactory.getFetcher(type)
            case "contestInfo.upcoming":
                return ContestInfoFetcherFactory.getFetcher(type)
            case "contestInfo.past":
                return ContestInfoFetcherFactory.getFetcher(type)
            case "contestProblems":
                return new ContestProblemsFetcher()
            default:
                return undefined
        }
    }
}

export {FetcherFactor}